package request

import (
	"bytes"
	"log"
	"net/http"
	"net/url"
)

func SendPostRequest(formData *url.Values, requestURL string) *http.Response {

	// 创建 POST 请求
	req, err := http.NewRequest("POST", requestURL, bytes.NewBufferString(formData.Encode()))
	if err != nil {
		log.Fatalf("Error creating request: %v", err)
	}

	// 设置请求头
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
	req.Header.Set("Accept", "text/html, */*; q=0.01")

	// 发送请求
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatalf("Error sending request: %v", err)
	}
	return resp
}
